#

| Chapter 2 UNIX Commands |

## rcp

    rcp [options] sources target

Copy files between machines. Both `sources` and `target` are filename specifications of the form `host`:`pathname`, where `host`: can be omitted for a file on the local machine. If no `pathname` is included in `target`, source files are placed in your home directory. If you have a different username on the remote host, specify the form `username`@`hostname`:`file`

### Options

-p

  Preserve in copies the modification times, access times, and modes of the source files.

-r

  If `target` and `sources` are both directories, copy each subtree rooted at `source`.

### Examples

Copy the local files junk and test to your home directory on machine hermes:

>     rcp junk test hermes:

Copy the local bin directory and all subdirectories to the /usr/tools directory on machine diana:

>     rcp -r /bin diana:/usr/tools

Copy all files in your home directory on machine hera, and put them in local directory /usr/daniel with times and modes unchanged:

>     rcp -p "hera:*" /usr/daniel

Quote the first argument to prevent filename expansion from occurring on the local machine.

Reference: pwd |  | Reference: red